import { createStore } from 'vuex'
// 自动导入
const modulesFiles = import.meta.globEager('./modules/**/*.js')
const modules = {}
for (const key in modulesFiles) {
  modules[key.replace(/(\.\/modules\/|\.js)/g, '')] = modulesFiles[key].default
}

Object.keys(modules).forEach(item => {
  modules[item]['namespaced'] = true
})

import getters from './getters' // 引入 getters

// import msbd from './modules/msbd.js'
// import user from './modules/user.js' // 处理 login
// import perminssion from './modules/perminssion.js'

const store = createStore({
  state: () => { },
  mutations: {},
  actions: {},
  getters,
  modules
})

export default store
